﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;

namespace YouHP.Pages.SymptomHistory
{
    public class HistoryDel : PatientBasePage
    {

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();

        }

        protected new  void HandleCommon()
        {
            this.AddLocation("症状记录", "/SymptomHistory/Index.aspx");
            this.AddLocation("删除症状信息", "/SymptomHistory/HistoryDel.aspx");
            this.SetTitle("删除症状信息");

            int id = RequestTools.GetQueryInt("id", 0);
            if (id <= 0)
            {
                this.AddErrLine("无效的疾病历史信息");
                return;
            }

            SymptomHistoryInfo info = PatientSymptomBLL.Instance.GetSymptomHistory(PrData.Id, id);
            if (info.Id <= 0)
            {
                this.AddErrLine("无效的疾病历史信息");
                return;
            }

            //if (info.SurveyId > 0)
            //{
            //    TempUrl = "/SymptomHistory/SurveyDel.aspx?id=" + info.SurveyId;
            //    ResponseHelper.Redirect(GetUrl(TempUrl));
            //    return;
            //}

            bool succ = PatientSymptomBLL.Instance.DeleteSymptomHistory(PrData.Id, id);
            if (succ)
            {
                this.AddMsgLine("删除成功");
                TempUrl = "/SymptomHistory/List.aspx?symid=" + info.SymptomId;
            }
            else 
            {
                this.AddMsgLine("删除失败");
                TempUrl = "/SymptomHistory/List.aspx?symid=" + info.SymptomId;
            }

            this.SetUrl(TempUrl);
            this.SetMetaRefresh();
        }

    }
}